/**
 * 
 */
package com.gf.common;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import com.gf.pf.model.User;

/**
 * @description 基础Controller
 * @date   Nov 18, 2014
 * @author sss
 */
public class BaseController {
	
	/**
	 * 登录用户键值
	 */
	@Value("#{propertiesReader['USER_SESSION_KEY']}")
	protected String USER_SESSION_KEY;
	
	/**
	 * 成功
	 */
	@Value("#{propertiesReader['RESULTMESSAGE_SUCCESS']}")
	protected int RESULTMESSAGE_SUCCESS;
	
	/**
	 * 失败
	 */
	@Value("#{propertiesReader['RESULTMESSAGE_FAIL']}")
	protected int RESULTMESSAGE_FAIL;
	
	/**
	 * 跟ID
	 */
	@Value("#{propertiesReader['ROOT_ID']}")
	protected String ROOT_ID;
	
	/**
	 * 短信服务路径
	 */
	@Value("#{propertiesReader['SMS_ULR']}")
	public String SMS_ULR;
	
	/**
	 * 短信服务方式0  乐信，1 华夏
	 */
	@Value("#{propertiesReader['SMS_COMPANY']}")
	public Integer SMS_COMPANY;
	
	/**
	 * 结果信息
	 */
	@Autowired
	protected ResultMessage resultMessage;
	
	/**
	 * 
	 * @description 获取当前用户
	 * @return User
	 */
	protected User getCurrentUser(HttpServletRequest request) {
		return (User) request.getSession().getAttribute(this.USER_SESSION_KEY);
	}
	
}
